<template>
	<view class="content">
		<view class="vm-chunk" v-for="(item,index) in dataList" :key="index">
			<view class="vm-chunk-title" @click="spreadCli(index)">{{item.createTime}}<view class="vm-chunk-title-image" :class="spreadArr[index].value===1?'':'vm-chunk-title-rotate'"></view></view>
			<view class="vm-chunk-content" :class="spreadArr[index].value===1?'vm-chunk-contentOpen':'vm-chunk-contentClose'">
				<uni-list class="vm-chunk-content-list" :border="false">
					<uni-list-item title="巡查人员" :rightText="iten.name"></uni-list-item>
					<uni-list-item title="巡查状态" :rightText="iten.system"></uni-list-item>
					<uni-list-item title="报损情况" :rightText="iten.system"></uni-list-item>
					<uni-list-item title="指示灯" :rightText="iten.system"></uni-list-item>
					<uni-list-item title="摄像头" :rightText="iten.system"></uni-list-item>
					<uni-list-item title="其他部件" :rightText="iten.system"></uni-list-item>
				</uni-list>
			</view>
		</view>
	</view>
</template>

<script>
	import {getPlanDetails} from '../../../api/device/device.js'
  export default {
	  data(){
		  return{
			  spreadArr:[],
			  dataList:[]
		  }
	  },
    onLoad(e) {
    	this.findListFu(e.id)
    },
	methods:{
		findListFu(id){
			this.spreadArr=[]
			getPlanDetails().then(res=>{
				if(res.code===200){
					res.data.forEach((item,index)=>{this.spreadArr.push({value:index===0?1:0})})
					this.dataList=res.data
				}
			})
		},
		spreadCli(index){
			this.spreadArr[index].value=this.spreadArr[index].value===1?0:1
		},
	}
  }
</script>
<style lang="scss">
  .content {
	 padding: 0 3%;
	 box-sizing: border-box;
	  .vm-chunk{
		  width: 100%;
		  padding: 20rpx;
		  box-sizing: border-box;
		  border-radius: 18rpx;
		  margin-top: 20rpx;
		  background: linear-gradient(to bottom,#edf9ff 0%,#fff 20%);
		  &-title{
			  font-size: 34rpx;
			  color: #000;
			  font-weight: 500;
			  line-height: 80rpx;
			  height: 80rpx;
			  position: relative;
			  &-image{
			   width: 60rpx;
			   height: 60rpx;
			   background: transparent url(../../../static/images/business/equipment-04.png) no-repeat;
			   background-size: 100% 100%;
			   position: absolute;
			   top: 10rpx;
			   right: 20rpx;
			  }
			  &-rotate{
				transform: rotate(180deg);
			  }
		  }
		  &-content{
			  &-list{
				  margin: 20rpx 0;
				  border-bottom:1px solid #e7f1fc;
			  }
		  }
		  &-contentOpen{
			  height: auto;
			  overflow: visible;
		  }
		  &-contentClose{
			height: 0;
			overflow: hidden;
		  }
	  }
	uni-button:after{
		border: none;
	}
	/deep/ .uni-list{
		background-color: transparent;
	}
	/deep/ .uni-list--border:after{
		background-color: transparent;
	}
  }
</style>